module.exports = {
  nav_name: '课程管理', //生成导航菜单
  module_name: 'course_manager',  //生成路径，与模块名相同
  api: `{
    //课程
    course_list_page: commonPath + "/admin/courseInfo/page", // 分页
    course_list_detail: commonPath + '/admin/courseInfo/get', //详情,
    course_list_add: commonPath + '/admin/courseInfo/saveCourseInfo', //添加
    course_list_del: commonPath + "/admin/courseInfo/remove", //删除
    course_list_edit: commonPath + "/admin/courseInfo/editCourseInfo", //编辑
    course_list_changeState: commonPath + '/admin/courseInfo/editState', //编辑状态
    course_list_set_vip: commonPath + "/admin/courseInfo/editBoutiqueState", //设为精品

    //课程分类
    course_sort_page: commonPath + "/admin/courseType/pageList",    //分页
    course_sort_detail: commonPath + "/admin/courseType/get",  //详情
    course_sort_add: commonPath + "/admin/courseType/save",     //添加
    course_sort_edit: commonPath + "/admin/courseType/edit", //编辑
    // course_sort_changeState: commonPath + "/admin/courseType/edit",  //状态 同编辑接口
    course_sort_del: commonPath + "/admin/courseType/remove",  //删除

    //课程章节
    course_chapter_page: commonPath + "/admin/courseSection/page",    //分页
    course_chapter_detail: commonPath + "/admin/courseSection/get",    //详情
    course_chapter_add: commonPath + "/admin/courseSection/save",    //添加
    course_chapter_edit: commonPath + "/admin/courseSection/edit",    //编辑
    course_chapter_del: commonPath + "/admin/courseSection/remove",  //删除
    course_chapter_sort: commonPath + "/admin/courseSection/editSort", //排序

    //课程内容
    course_content_page: commonPath + "/admin/courseContent/page", //分页
    course_content_detail: commonPath + "/admin/courseContent/get", //详情
    course_content_add: commonPath + "/admin/courseContent/save", //添加
    course_content_edit: commonPath + "/admin/courseContent/edit", //编辑
    course_content_del: commonPath + "/admin/courseContent/remove", //删除
    course_content_editSort: commonPath + "/admin/courseContent/editSort", //修改排序
  }`,
  table1: {
    table_name: "course_list",
    nav_name: "课程列表",
    tipsText: "课程管理 >> 课程列表",
    pageApi: "API.course_manager.course_list_page",  //自定义api，高优先级，未设置则取默认page的api
    //获取列表页面
    tableData: [
      { title: '序号', name: 'index', type: "normal" },
      { title: '课程名称', name: 'courseName', type: "normal", showObj: "{}" },
      {
        title: '封面',
        name: 'courseImg',
        itemWidth: "120", //宽度调整
        type: "img",
        heightVal: "66",
        widthVal: "66",
      },
      {
        title: '类别',
        name: '',
        type: "innerCode",
        innerCode: `{{courseTypeShow[scope.row.courseTypeId] || ""}}`
      },
      {
        title: '价格',
        name: 'price',
        type: "innerCode",
        innerCode: `{{(scope.row.price) ? scope.row.price : "免费"}}`,
      },
      { title: '上传时间', name: 'gmtModified', type: "normal", showObj: "{}" },
      {
        title: '状态',
        name: 'state',
        type: "opts",
        showName: "stateShow",
        showObj: `{
          "1": "上架",
          "2": "下架",
        }`
      },
      {
        title: '是否精品',
        name: 'state',
        type: "innerCode",
        innerCode: `{{scope.row.isBoutique == '1' ? "是" : "否"}}`,
      },
    ],
    tableOptLen: "480",
    tableOpt: [
      {
        type: "view",
        text: "章节", //详细页面跳转章节列表
        request: false,
        jump: "/course_manager_course_chapter"
      },
      {
        type: "changeState",
        text: "上架",
        request: true,
        url: "API.course_manager.course_list_changeState",
        requestType: 'post',
        params: `{id,  state: 1 }`, //必须为文本 状态 1上架 2下架
        methodNameTag: 'Open', //方法衔接拓展名 changeState Black
        showCondition: `scope.row.state == '2'`,  //展示条件，没有就不传或置为空
      },
      {
        type: "changeState",
        text: "下架",
        request: true,
        url: "API.course_manager.course_list_changeState",
        requestType: 'post',
        params: `{id,  state: 2 }`, //必须为文本
        methodNameTag: 'Close', //方法衔接拓展名 changeState Black
        showCondition: `scope.row.state == '1'`,  //展示条件，没有就不传或置为空
      },

      {
        type: "modify",
        text: "编辑",
        request: false,
        jump: "/course_manager_add_course"
      },
      {
        type: "del",
        text: "删除",
        request: true,
        url: "API.course_manager.course_list_del",
        requestType: 'get',
        // isSplitSearchString: 'true', //拼接查询字符串
      },
      {
        type: "changeState",
        text: "设为精品",
        request: true,
        url: "API.course_manager.course_list_set_vip",
        requestType: 'post',
        params: `{id,  state: 1 }`, //必须为文本
        methodNameTag: 'SetGood', //方法衔接拓展名 changeState Black
        showCondition: `scope.row.isBoutique == '2'`,  //展示条件，没有就不传或置为空
      },
      {
        type: "changeState",
        text: "取消精品",
        request: true,
        url: "API.course_manager.course_list_set_vip",
        requestType: 'post',
        params: `{id,  state: 2 }`, //必须为文本
        methodNameTag: 'CancelGood', //方法衔接拓展名 changeState Black
        showCondition: `scope.row.isBoutique == '1'`,  //展示条件，没有就不传或置为空
      },
    ],
    search: {
      contentArr: {
        input1: { labelName: '名称', inputName: 'courseName' },
        select1: {
          labelName: '上架状态',
          inputName: 'state',  //输入绑定的变量
          selectOptsName: "stateOpts",
          selectOptsArr: `[
            { value: "1", label: "上架" },
            { value: "2", label: "下架" },
            { value: "", label: "全部" },
          ],
          `, //选项数组
        },
        date1: {
          labelName: '上传时间',
          inputName: 'upLoadTime', //仅用于标志
          dateConfig: {
            startDateName: 'startDate',
            endDateName: 'endDate',
            dateChangeMethodsName: 'handleUploadDateChange'
          },
        },
      },
      searchBtn: {
        text: "查询", //链接与table请求接口相同，不做另外配置
      },
      addBtn: {
        //搜索栏具有添加功能按钮时，设置此字段
        type: "add",
        text: "添加",
        request: false,
        jump: "/course_manager_add_course"
      }
    },

    // //额外请求
    extraRequest: {
      dataCode: [
        "courseOpts"
      ],
      methodsCode: [
        {
          explainText: "课程类别获取", //说明
          type: "opts&&shows",  //表示选项类型格式，value, label
          methodName: "getRoleData",
          api: "API.course_manager.course_sort_page",
          optsName: "courseOpts",
          showName: "courseTypeShow",
          params: `{
            "pageIndex": 1,
            "pageSize": 100,
          }`,
          optsConfig: {
            label: "typeName",
            value: "id"
          },
          showConfig: {
            key: "id",
            value: "typeName"
          },
        }
      ]
    },

  },

  //课程添加
  add_page1: {
    isGenerate: 'false',
    add_page_name: "add_course",  //尽量短些,要拼接路由
    tipsText: "课程管理 >> 课程",
    formData: {
      titleText: "请填写管理员相关信息",
      //三种类型，输入，下拉，图片上传
      input1: {
        labelName: '课程名称',
        inputName: 'courseName',
        isNeed: 'true',
      },
      textarea10: {
        labelName: '课程简介',
        inputName: 'remark',
        isNeed: 'true',
        rows: "5",
        width: "360", //自动补全px
        isNeed: 'true',
      },
      //图片上传
      uploadImg1: {
        labelName: "课程封面图",
        inputName: "courseImg",
        type: "many", //type: "single"
        countLimit: "1",
        uploadMethod: "handleUploadBanner"
        // isNeed: 'true',
      },
      radio1: {
        labelName: '课程状态',
        inputName: 'state',
        radioOpts: [
          { value: "1", label: "上架" },
          { value: "2", label: "下架" },
        ], //这是个同select结构的枚举,但为对象格式
        isNeed: 'true',
        radioWidth: '60px'
      },
      radio2: {
        labelName: '课程价格',
        inputName: 'chargeState',
        radioOpts: [
          { value: "1", label: "收费" },
          { value: "2", label: "免费" },
        ], //这是个同select结构的枚举,但为对象格式
        isNeed: 'true',
        radioWidth: '60px'
      },
      input2: {
        labelName: '课程金额',
        inputName: 'price',
        // isNeed: 'true', //非必填
        disabledCondition: `formData.state == 2 || formData.chargeState == 2`,
      },
      select1: {
        labelName: '课程类别',
        inputName: 'courseTypeId',  //输入绑定的变量
        selectOptsName: "courseTypeOpts",
        selectOptsArr: `[],
          `, //选项数组
        isNeed: 'true',
      },
      // //三级联动组件
      // address1: {
      //   label: "地址选择",
      //   inputName: "",
      // }
    },

    //额外请求
    extraRequest: {
      dataCode: [
        "courseTypeOpts"
      ],
      methodsCode: [
        {
          explainText: "课程类别获取", //说明
          type: "opts",  //表示选项类型格式，value, label
          methodName: "getCourseTypeData",
          api: "API.course_manager.course_sort_page",
          optsName: "courseTypeOpts",
          params: `{
            "pageIndex": 1,
            "pageSize": 100,
          }`,
          optsConfig: {
            label: "typeName",
            value: "id"
          }
        }
      ]
    },
    addBtn: {
      text: '立即添加',
      url: "API.course_manager.course_list_add",
      jumpPath: "/course_manager_course_list", //添加成功自动跳转到
    },
    //
    editBtn: {
      text: '编辑',
      detailUrl: "API.course_manager.course_list_detail",
      detailType: 'get',
      detailParams: {},  //这里是对象,非字符串, 只能写给定值的参数
      editUrl: "API.course_manager.course_list_edit",
      jumpPath: '/course_manager_course_list',  //添加成功自动跳转到页面
      isSplitSearchString: 'true', //列表拼接查询字符串
    },
    cancelBtn: { text: "取消" }, //
    // extraFunction: `

    // `,
  },



  //课程分类
  table2: {
    table_name: "course_sort",
    nav_name: "课程分类", //不展示路由的此字段不要
    tipsText: "课程管理 >> 课程分类",
    pageApi: "API.course_manager.course_sort_page",  //自定义api，高优先级，未设置则取默认page的api
    //获取列表页面
    tableData: [
      { title: '序号', name: 'index', type: "normal" },
      { title: '类别名称', name: 'typeName', type: "normal", showObj: "{}" },
      {
        title: '封面',
        type: "img",
        itemWidth: "220", //宽度调整
        name: 'imgUrl',
        heightVal: "60",
        widthVal: "100",
      },
    ],
    tableOpt: [
      // {
      //   type: "view",
      //   text: "章节", //详细页面跳转章节列表
      //   request: false,
      //   jump: "/member_manager/see_detail_member查看"
      // },
      {
        type: "modify",
        text: "编辑",
        request: false,
        jump: "/course_manager_add_course_sort"
      },

      {
        type: "del",
        text: "删除",
        request: true,
        url: "API.course_manager.course_sort_del",
        requestType: 'del',
      },

    ],
    search: {
      contentArr: {
        // input1: { labelName: '名称', inputName: 'tel' },
        // select1: {
        //   labelName: '上架状态',
        //   inputName: 'state',  //输入绑定的变量
        //   selectOptsName: "stateOpts",
        //   selectOptsArr: `[
        //     { value: "1", label: "上架" },
        //     { value: "2", label: "下架" },
        //     { value: "", label: "全部" },
        //   ],
        //   `, //选项数组
        // },
      },
      // searchBtn: {
      //   text: "查询", //链接与table请求接口相同，不做另外配置
      // },
      addBtn: {
        //搜索栏具有添加功能按钮时，设置此字段
        type: "add",
        text: "新增类别",
        request: false,
        jump: "/course_manager_add_course_sort"
      }
    },
  },

  // 课程分类添加
  add_page2: {
    add_page_name: "add_course_sort",  //尽量短些,要拼接路由
    tipsText: "课程管理 >> 课程类别",
    formData: {
      // titleText: "请填写管理员相关信息",
      //三种类型，输入，下拉，图片上传
      input1: {
        labelName: '类别名称',
        inputName: 'typeName',
        isNeed: 'true',
      },
      //图片上传
      uploadImg1: {
        labelName: "类别图",
        inputName: "imgUrl",
        type: "many", //type: "single"
        countLimit: "1",
        uploadMethod: "handleUploadCourseSort",
        isNeed: 'true',
      },
      radio1: {
        labelName: '课程状态',
        inputName: 'state',
        radioOpts: [
          { value: "1", label: "启用" },
          { value: "2", label: "禁用" },
        ], //这是个同select结构的枚举,但为对象格式
        isNeed: 'true',
        radioWidth: '60px'
      },
    },
    addBtn: {
      text: '立即添加',
      url: "API.course_manager.course_sort_add",
      jumpPath: "/course_manager_course_sort"
    }, //
    editBtn: {
      text: '编辑',
      detailUrl: "API.course_manager.course_sort_detail",
      detailType: 'get',
      detailParams: {},  //这里是对象,非字符串, 只能写给定值的参数
      editUrl: "API.course_manager.course_sort_edit",
      jump: '/course_manager_course_sort',
      isSplitSearchString: 'true', //拼接查询字符串
    },
    cancelBtn: { text: "取消" }, //
  },




  //章节列表
  table3: {
    table_name: "course_chapter",
    // nav_name: "课程章节", //不展示路由的此字段不要
    tipsText: "课程管理 >> 课程章节",
    pageApi: "API.course_manager.course_chapter_page",  //自定义api，高优先级，未设置则取默认page的api
    extraPageRequestParams: `
      courseId: this.$route.query.id,  //请求
    `, //已有page和pageSize
    // {
    //   "courseId": 0,
    //   "pageIndex": 1,
    //   "pageSize": 10,
    //   "sectionId": 0,
    //   "title": "string"
    // }
    //获取列表页面
    tableData: [
      { title: '序号', name: 'index', type: "normal" },
      { title: '名称', name: 'sectionName', type: "normal", showObj: "{}" },
      { title: '上传时间', name: 'gmtModified', type: "normal", showObj: "{}" },
    ],
    tableOptLen: "400",
    tableOpt: [
      {
        type: "view",
        text: "查看内容",
        request: false,
        jump: "/course_manager_course_content",
        extraQueryParams: ` { sectionId: id, courseId: _this.$route.query.id } `
      },
      {
        type: "modify",
        text: "编辑",
        request: false,
        jump: "/course_manager_add_course_chapter",
        extraQueryParams: ` { id, courseId: _this.$route.query.id  } `
      },
      {
        type: "del",
        text: "删除",
        request: true,
        url: "API.course_manager.course_chapter_del",
        requestType: 'get',
      },
      {
        type: "sort",
        text: "调整排序",
        url: "API.course_manager.course_chapter_sort",
        requestType: 'get',
      },
    ],
    search: {
      contentArr: {
        input1: { labelName: '章节名称', inputName: 'sectionName' },
      },
      searchBtn: {
        text: "查询", //链接与table请求接口相同，不做另外配置
        extraParams: //请求的额外参数
          `
          courseId: _this.$route.query.id,
        `,
      },
      //这是个弹窗，改成页面
      addBtn: {
        //搜索栏具有添加功能按钮时，设置此字段
        type: "add",
        text: "新增章节",
        request: false,
        jump: "/course_manager_add_course_chapter",
        extraQueryParams: ` { courseId: _this.$route.query.id, } `, //这个方法在集合里，用_this
      }
    },
  },


  //章节添加 
  add_page3: {
    add_page_name: "add_course_chapter",  //尽量短些,要拼接路由
    tipsText: "课程管理 >> 课程章节",
    formData: {
      // titleText: "请填写管理员相关信息",
      //三种类型，输入，下拉，图片上传
      input: {
        labelName: '章节名称',
        inputName: 'sectionName',
        isNeed: 'true',
        rows: "5",
        width: "360", //自动补全px
      },
    },
    addBtn: {
      text: '立即添加',
      url: "API.course_manager.course_chapter_add",
      extraParams: ` courseId: Number(this.$route.query.courseId), `,
      jumpPath: "/course_manager_course_chapter",
      extraQueryParams: ` { id: this.$route.query.courseId } `,
    }, //
    editBtn: {
      text: '编辑',
      detailUrl: "API.course_manager.course_chapter_detail",
      detailType: 'get',
      detailParams: {},  //这里是对象,非字符串, 只能写给定值的参数
      isSplitSearchString: 'true', //拼接查询字符串
      editUrl: "API.course_manager.course_chapter_edit",
      jumpPath: '/course_manager_course_chapter',
      extraQueryParams: ` { id: this.$route.query.courseId } `,
    },
    cancelBtn: { text: "取消" }, //
  },



  //内容列表
  table4: {
    table_name: "course_content",
    // nav_name: "课程内容", //不展示路由的此字段不要
    tipsText: "课程管理 >> 课程内容",
    pageApi: "API.course_manager.course_content_page",  //自定义api，高优先级，未设置则取默认page的api
    extraPageRequestParams: //请求附加参数, 直接的代码拼接
      `
      courseId: this.$route.query.courseId, //课程id
      sectionId: this.$route.query.sectionId, //章节id  
    `,
    // {
    //   "courseId": 0,
    //   "pageIndex": 1,
    //   "pageSize": 10,
    //   "sectionId": 0,
    //   "title": "string"
    // }
    //获取列表页面
    tableData: [
      { title: '序号', name: 'index', type: "normal" },
      { title: '标题', name: 'title', type: "normal", showObj: "{}" },
      {
        title: '类型',
        name: 'type',
        type: "opts",
        showName: "typeOpts",
        showObj: `{
          "1": "图文",
          "2": "视频"
        }`
      },
    ],
    tableOpt: [
      {
        type: "modify",
        text: "编辑",
        request: false,
        jump: "/course_manager_add_course_content",
        extraQueryParams: ` { 
          id, 
          courseId: _this.$route.query.courseId,
          sectionId: _this.$route.query.sectionId,
        } `,
      },
      {
        type: "del",
        text: "删除",
        request: true,
        url: "API.course_manager.course_content_del",
        requestType: 'get',

      },
    ],
    search: {
      contentArr: {
        input1: {
          labelName: '标题',
          inputName: 'title',
        },
      },
      searchBtn: {
        text: "查询", //链接与table请求接口相同，不做另外配置
        extraParams: //请求的额外参数
          `
          courseId: _this.$route.query.courseId,
          sectionId: _this.$route.query.sectionId,
        `,
      },
      //这是个弹窗，改成页面
      addBtn: {
        //搜索栏具有添加功能按钮时，设置此字段
        type: "add",
        text: "新增内容",
        request: false,
        jump: "/course_manager_add_course_content",
        extraQueryParams: ` { 
          courseId: _this.$route.query.courseId,
          sectionId: _this.$route.query.sectionId,
        } `,
      }
    },
  },

  //内容添加 
  add_page4: {
    isGenerate: 'false',
    add_page_name: "add_course_content",  //尽量短些,要拼接路由
    tipsText: "课程管理 >> 课程内容",
    formData: {
      // titleText: "请填写管理员相关信息",
      input: {
        labelName: '课程标题',
        inputName: 'title',
        isNeed: 'true',
        rows: "5",
        width: "360", //自动补全px
      },
      textarea1: {
        labelName: '课程简介',
        inputName: 'synopsis',
        isNeed: 'true',
        rows: "5",
        width: "360", //自动补全px
        isNeed: 'true',
      },
      radio1: {
        labelName: '课程类型',
        inputName: 'type',
        radioOpts: [
          { value: "1", label: "图文" },
          { value: "2", label: "视频" },
        ], //这是个同select结构的枚举,但为对象格式
        isNeed: 'true',
        radioWidth: '60px',
        // defaultValue: "", //初始默认值
      },
      richText1: {
        labelName: '课程内容(图文)',
        inputName: 'content',
        minHeight: "180", //高度
        uploadApi: "API.common.upload",
        editContentChangeMethodName: "handleBgEditChange", //改变方法
        // isNeed: 'true',
        showCondition: `formData.type == 1`,
      },
      //图片上传
      uploadImg4: {
        labelName: "视频上传",
        inputName: "content",
        type: "many", //type: "single"
        countLimit: "1",
        uploadMethod: "handleUploadCourseSort",
        // isNeed: 'true',
        showCondition: `formData.type == 2`,
      },
    },
    addBtn: {
      text: '立即添加',
      url: "API.course_manager.course_content_add",
      extraParams: //请求的额外参数
        `
          courseId: this.$route.query.courseId,
          sectionId: this.$route.query.sectionId,
        `,
      jumpPath: "/course_manager_course_content",
      extraQueryParams: //跳转的额外参数
        ` { 
          courseId: this.$route.query.courseId,
          sectionId: this.$route.query.sectionId,
        } `,
    },
    editBtn: {
      text: '编辑',
      detailUrl: "API.course_manager.course_content_detail",
      detailType: 'get',
      detailParams: {},  //这里是对象,非字符串, 只能写给定值的参数
      isSplitSearchString: 'true', //拼接查询字符串
      editUrl: "API.course_manager.course_content_edit",
      extraParams: //请求的额外参数
        `
          courseId: this.$route.query.courseId,
          sectionId: this.$route.query.sectionId,
        `,
      jumpPath: '/course_manager_course_content',
      extraQueryParams: //跳转的额外参数
        ` { 
          courseId: this.$route.query.courseId,
          sectionId: this.$route.query.sectionId,
        } `,
    },
    cancelBtn: { text: "取消" }, //
  },


}
